package com.fishery.monitor.dao;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fishery.monitor.mapper.MonitorEquipmentMapper;
import com.fishery.monitor.mapper.MonitorMeteorologicalDataMapper;
import com.fishery.monitor.pojo.Equipment;
import com.fishery.monitor.pojo.MeteorologicalData;
import com.fishery.monitor.pojo.MonitorBase;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


import java.util.List;


/**
 * 数据访问接口
 * @author Administrator
 *
 */
@Component
public class MeteorologicalDataDao {

    @Autowired
    MonitorMeteorologicalDataMapper monitorMeteorologicalDataMapper;


    public IPage<MeteorologicalData> findAll(Page<MeteorologicalData> page, QueryWrapper<MeteorologicalData> wrapper) {
        return monitorMeteorologicalDataMapper.selectPage(page,wrapper);
    }

    public List<MeteorologicalData> findAll(QueryWrapper<MeteorologicalData> wrapper) {
        return  monitorMeteorologicalDataMapper.selectList(wrapper);
    }

    public MeteorologicalData findById(String id) {
        return (MeteorologicalData)this.monitorMeteorologicalDataMapper.selectById(id);
    }

    public void update(MeteorologicalData meteorologicalData) {
        this.monitorMeteorologicalDataMapper.updateById(meteorologicalData);
    }

//    public Page<Double> querySource(String checkItemName, String equipmentId, String startTime, String endTime, PageRequest pageRequest) {
//    @Query(value = "SELECT  ?1 FROM `monitor_meteorological_data`  where equipmentId=?2 and acquisitionTime > ?3 and acquisitionTime < ?4 ",nativeQuery = true)
//    Page<Double> querySource(String checkItemName, String equipmentId, String startTime, String endTime, Pageable pageable);
//    }
}
